import {
	http
} from '@/common/service/service.js'
import configService from '@/common/service/config.service.js';
const apiService = {

	/**
	 * 登录
	 */
	login(params) {
		return http.post('/login/index', params)
	},

	//试玩体验
	loginTest(params) {
		return http.post('/login/test', params);
	},
	phoneNoLogin(params) {
		return http.post('/sys/phoneLogin', params);
	},

	/**
	 * 注册
	 */
	registerLogin(params) {
		return http.post('/login/register', params);
	},

	/**
	 * 修改密码
	 */
	updateLogin(params) {
		return http.post('/pwd/update', params);
	},
	/**
	 * 退出
	 */
	logout(params) {
		return http.post('/sys/logout', params);
	},
	//验证码
	getVscode(params) {
		return http.post('/verify', params);
	},

	//用户信息
	getUserInfo(params) {
		return http.post('/user/index', params);
	},
	//用户信息
	getConfig(params) {
		return http.post('/user/config', params);
	},


	/**
	 * 获取文件访问路径
	 * @param avatar
	 * @param subStr
	 * @returns {*}
	 */
	getFileAccessHttpUrl(avatar, subStr) {
		if (!subStr) subStr = 'http'
		if (avatar && avatar.startsWith(subStr)) {
			return avatar;
		} else {
			return configService.staticDomainURL + "/" + avatar;
		}
	}
};

export default apiService;
